﻿/*
 * Created by SharpDevelop.
 * User: Administrator
 * Date: 2016/4/21
 * Time: 18:14
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;
using System.Collections.Generic;
using Common;
using SharpChannel.Rpc;
using SharpChannel.Rpc.Proxy;
using log4net.Config;

namespace TestServer
{
    internal class ServiceImpl : ITestService
    {
        #region ITestService implementation

        public int TestAdd(int a, int b)
        {
            return a + b;
        }

        public string SayHelloTo(string name)
        {
            return "你好:" + name;
        }

        public string TestVoid()
        {
            return "no params";
        }

        public void TestVoid2(int a, string b, object[] args)
        {
            Console.WriteLine(b + a + args);
        }

        public TestDO DoTestDO(TestDO do1, List<TestDO> do2)
        {
            Console.WriteLine(do1.ToString() + do2);
            return do1;
        }

        public List<T> GetAllKv<T>(List<T> list, string key)
        {
            Console.WriteLine(key + list);
            return list;
        }

        #endregion
    }

    internal class Program
    {
        public static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            SharpChannelServer<ITestService> server = new SharpChannelServer<ITestService>(new ServiceImpl());
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}